//
//  PublicConfig.h
//  ifangchou
//
//  Created by guang on 15/9/28.
//  Copyright © 2015年 ifangchou. All rights reserved.
//

#import "SwitchConfig.h"

#ifndef PublicConfig_h
#define PublicConfig_h

#define IOS7_OR_LATER [[UIDevice currentDevice].systemVersion floatValue] >= 7.0f
#define IOS8_OR_LATER [[UIDevice currentDevice].systemVersion floatValue] >= 8.0f

#define IS_IPAD (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
#define IS_IPHONE (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
#define IS_RETINA ([[UIScreen mainScreen] scale] >= 2.0)

#define MAIN_SCREEN_WIDTH ([[UIScreen mainScreen] bounds].size.width)
#define MAIN_SCREEN_HEIGHT ([[UIScreen mainScreen] bounds].size.height)
#define SCREEN_MAX_LENGTH (MAX(MAIN_SCREEN_WIDTH, MAIN_SCREEN_HEIGHT))
#define SCREEN_MIN_LENGTH (MIN(MAIN_SCREEN_WIDTH, MAIN_SCREEN_HEIGHT))

#define IS_IPHONE_4_OR_LESS (IS_IPHONE && SCREEN_MAX_LENGTH < 568.0)
#define IS_IPHONE_5 (IS_IPHONE && SCREEN_MAX_LENGTH == 568.0)
#define IS_IPHONE_6 (IS_IPHONE && SCREEN_MAX_LENGTH == 667.0)
#define IS_IPHONE_6P (IS_IPHONE && SCREEN_MAX_LENGTH == 736.0)

//缓存的主目录
#define CACHE_DIRECTORY [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) lastObject]
#define DOCUMENTS_DIRECTORY [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject]

#define degreesToRadinas(x) (M_PI * (x)/180.0)

#define OBFUSCATE_KEY @"+++!"

#define kCurrentUser  @"kCurrentUser"
#define CURRENT_USER  [[NSUserDefaults standardUserDefaults] valueForKey:kCurrentUser]

#define CURRENT_USER_DIRECTORY  [DOCUMENTS_DIRECTORY stringByAppendingPathComponent:CURRENT_USER]
#define CURRENT_USER_MEDIA_DIRECTORY [CURRENT_USER_DIRECTORY stringByAppendingPathComponent:@"media"]
#define AFN_IMAGE_DIRECTORY [[CACHE_DIRECTORY stringByAppendingPathComponent:CURRENT_USER] stringByAppendingPathComponent:@"afn_imageView"]

#define ProjectList_MD5_Mark @"ProjectList_MD5_Mark"
#define UserTags_MD5_Mark  @"UserTags_MD5_Mark" 
#define KEY_LAST_GET_AD_TIME @"LastGetAdTime"

#if !SHOW_LOG_INFO
    #define NSLog(...) {}
#endif

#endif /* PublicConfig_h */
